package com.java.array;

public class ArrayFindDemo2 {
    public static int findMax(int[] array){
        int max = array[0];
        for (int i = 1; i < array.length; i++) {
            if (max < array[i]){
                max = array[i];
            }
        }
        return max;
    }
    public static void main(String[] args) {
        //定义数组
        int[] arr = {43,65,23,85,24,84,21};
        int Max = findMax(arr);
        System.out.println("最大值为:："+Max);
    }
}
